package cn.thens.kdroid.core.log

class PrettyLogger(private val logger: ILogger) : ILogger {
    private var priority: Int = ILogger.VERBOSE
    private var tag: String = ""

    private val printer = PrettyPrinter(IPrinter { message -> logger.log(priority, tag, message) })

    val settings get() = printer.settings

    override fun log(priority: Int, tag: String, message: String) {
        this.priority = priority
        this.tag = tag
        settings.style = if (priority < ILogger.WARN) PrettyStyle.SINGLE else PrettyStyle.DOUBLE
        printer.print(message)
    }
}